import com.demo.model.Student;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.xml.XmlBeanFactory;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.core.io.ClassPathResource;

public class AppBean {
    public static void main(String[] args) {
        // 1. 获取Spring对象
        ApplicationContext context = new ClassPathXmlApplicationContext("spring-config.xml");
        // BeanFactory context = new XmlBeanFactory(new ClassPathResource("spring-config.xml"));

        // 2. 获取Bean对象：方法注解
        Student student = context.getBean("s2",Student.class);

        // 使用Bean
        System.out.println(student);
    }
}